#!/bin/bash
# Intention Trainer
# Think of any number that you want to generate by the random number generator.
#
# Copyright 2007 Joel Bryan T. Juliano <joelbryan.juliano@gmail.com>
# GNU Public License

counter=0;
rounds=10;

rm -rf /tmp/random_numbers
while [ $counter -ne $rounds ]
   do
    RANDOM_NUMBERS=$(head -c4 /dev/urandom | od -N4 -tu4 | sed -ne '1s/.* //p');
    echo $RANDOM_NUMBERS
    echo $RANDOM_NUMBERS >> /tmp/random_numbers
    sleep 1s
    counter=$(( $counter + 1 ));
   done

for i in `seq 0 9`;
   do
    NUMCOUNT=$(cat /tmp/random_numbers | grep "$i" | wc -l);
    CHARCOUNT=$(cat /tmp/random_numbers | tr -dc $i | wc -c);
    echo "There are $NUMCOUNT / $rounds lines with the number $i, and $CHARCOUNT character counts"
   done
